﻿<!--#include file="../base.asp"-->
<%if IsLogin then %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>信息资源保存</title>
</head>

<body>
<%
dim local,contid,strSQL,rs
local=request.QueryString("local")
contid=request.QueryString("contid")
if request.Form("title")<>"" and request.Form("content")<>"" and request.Form("cat")<>"" then
'添加无类别信息
if contid="" then
strSQL="select * from info"
set rs=GetRecordset(strSQL,1)
rs.addnew
rs("infoTitle")=request.Form("title")
rs("infoContent")=request.Form("content")
rs("catID")=request.Form("cat")
rs("infoDate")=now()
if request.Form("ckbLogin")="on" then
    rs("needLogin")=1
else rs("needLogin")=0
end if
rs("userNum")=request.Cookies("username")
rs("filePath")=GetPic(request.Form("content"))
rs.update
showMsg "添加成功！",3,""
response.Redirect(local&"/list_info.aspx")
rs.close
set rs=nothing
CLoseDataBase
else

'修改无类别信息
strSQL="select * from info where infoID="&contid&" and [delete]=0"
set rs=GetRecordset(strSQL,1)
if not rs.eof and not rs.bof then
rs("infoTitle")=request.Form("title")
rs("infoContent")=request.Form("content")
rs("catID")=request.Form("cat")
rs("infoDate")=now()
if request.Form("ckbLogin")="on" then
    rs("needLogin")=1
else rs("needLogin")=0
end if
rs("userNum")=request.Cookies("username")
rs("filePath")=GetPic(request.Form("content"))
rs.update
showMsg "修改成功！",3,""
response.Redirect(local&"/list_info.aspx")
rs.close
set rs=nothing
CLoseDataBase
else showMsg "警告：非法操作！",3,""
end if
end if

else 
    showMsg "标题、内容或类别不能为空！<br />点击<a href='javascript:history.back()'>这里</a>返回",4,"" 
end if
%>
</body>
</html>
<%end if %>